﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering;

public class PathNode
{
    public int x { get; private set; }
    public int y { get; private set; }
    Grid<PathNode> g;

    public int gCost;       //自身代价
    public int hCost;       //距离代价
    public int fCost;       //总代价

    public bool isWalkable = true;

    public PathNode cameFromNode;

    public PathNode(int x, int y, Grid<PathNode> g)
    { 
        this.x = x;
        this.y = y;
        this.g = g;
    }



    public void SetWalkable(bool value)
    {
        isWalkable = value;
        g.OnTriggerChange(x, y);
    }


    public void CalculateFCost()
    {
        fCost = gCost + hCost;
    }

    public override string ToString()
    {
        return x + "," + y;
    }
}
